import React from 'react'

export default function ComB(props) {
    const { stateB,setStateA,setStateB } = props
    const onButtonClick = () => {
        setStateA(stateB)
    }
    const onRestButtonClick = () => {
        setStateB("B")
    }
    return (
        <div>
            {stateB}
            <button onClick={onButtonClick}>把A变成B</button>
            <button onClick={onRestButtonClick}>还原B</button>
        </div>
    )
}
